package com.gather.zx;

import java.util.Objects;

public class Student implements Comparable<Student>{
	private String name;
	private int age;
	private int id;
	

	
	public Student(String name, int age, int id) {
		super();
		this.name = name;
		this.age = age;
		this.id = id;
	}
	public Student() {
		super();
	}
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int hashCode() {
		return Objects.hash(name);
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Student other = (Student) obj;
		return Objects.equals(name, other.name);
	}

	@Override
	public String toString() {
		return "Student [name=" + name + ", age=" + age + ", id=" + id + "]";
	}
	public int compareTo(Student o) {
//		
//		if(this.id<o.id)
//		{
//			return -1;
//		}
//		else if(this.id==o.id)
//		{
//			return 0;
//		}
//		else
//		{
//			return 1;
//		}
	if(this.age<o.age) {
		return -1;
	}
	else if(this.age==o.age) {
		return 0;
	}
	else {
		return -1;
	}
		
	}
}
